What you will see in this episode…

  1. Defining “From Scratch” & Setting Expectations
  2. What you need to start & Target Audience
  3. Simple explanation of core concepts
  4. Building a simple neural network in Python

This is my promise

Rick Astley’s promises:

  • Never gonna give you up.
  • Never gonna let you down.
  • Never gonna run around and desert you.
  • Never gonna make you cry.
  • Never gonna say goodbye.
  • Never gonna tell a lie and hurt you.

About me

What you will see in the end…

Article text

NASA's Mars rover has discovered new evidence of ancient water on the red planet.
Rock samples taken from the surface show signs of mineral deposits that typically
  form in the presence of water. 
This discovery strengthens the theory that Mars may have once supported
  microbial life.
Scientists are now planning future missions to explore these areas further.

Question

question = 'What did the Mars rover find'
answer = generate_answer(question)
print(answer)

Answer

What did the Mars rover find: the theory that mars may have once supported microbial life scientists 

What do I mean “from scratch”

Python Programming Language

Pytorch library

Visual Studio Code IDE

Target audience (Intermediate lecture)

What you should know:

  • Basic Python programming knowledge
  • How to install python libraries
  • Using a Python IDE like VSCODE

Installing software

  • Python (https://www.python.org/)
  • VSCODE (https://code.visualstudio.com/)

NOTE: You can algo install from Microsoft Store, if you are on Windows OS

Evaluate if all OK

python --version
pip --version

Installing Python libraries

Create a virtual environment

https://docs.python.org/3/library/venv.html

python -m venv llm-venv
source llm-venv/bin/activate

Install python libraries

pip install jupyterlab torch

Install VSCODE extensions

  • Python
  • Jupyter
  • Pytorch

Modeling Sequential Data Using: Recurrent Neural Networks

Now where the fun part starts…

Creating a simple neural network in Python

class SimpleRNN(nn.Module):
    def __init__(self):
        super(SimpleRNN, self).__init__()
        self.rnn = nn.RNN(input_size=1, hidden_size=2, batch_first=True)
        self.fc = nn.Linear(2, 1)

    def forward(self, x):
        out, _ = self.rnn(x)
        out = self.fc(out[:, -1, :])
        return out

Are you finnish ?